﻿using EkStudio.com.bean.xml.BillChart;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EkStudio.com.ui.unitbill.property
{
    public class BillChartModuleToProperty
    {
        private BillChartModuleItem bean = null;

        public BillChartModuleToProperty(BillChartModuleItem bill)
        {
            bean = bill;
        }

        public string Caption
        {
            get { return bean.ChartProperties.Caption; }
            set { bean.ChartProperties.Caption = value; }
        }

        public string Key
        {
            get { return bean.ChartProperties.Key; }
            set { bean.ChartProperties.Key = value; }
        }

        public string GroupList
        {
            get { return bean.ChartProperties.GroupList; }
            set { bean.ChartProperties.GroupList = value; }
        }

        [Description("是否显示在右侧统计列表中，否则以大图标显示在左侧")]
        public bool ListMenu
        {
            get { return bean.ChartProperties.ListMenu; }
            set { bean.ChartProperties.ListMenu = value; }
        }

        /// <summary>
        /// SQL数据源
        /// </summary>
        [Description("在存在扩展代码的情况下，数据源只作为查询条件的数据源")]
        public string ChartSql
        {
            get { return "[DataSource]"; }
            set {  }
        }
        [Description("扩展代码将存在的情况下将替代数据源")]
        /// <summary>
        /// 扩展代码编辑
        /// </summary>
        public string Content
        {
            get { if (bean.ExpandCode != null && bean.ExpandCode.JavaPlugin != null && bean.ExpandCode.JavaPlugin.JavaItem != null &&bean.ExpandCode.JavaPlugin.JavaItem.Count>0) return "[JavaExp]"; else return "[NULL]"; }
            set { }
        }

        [DescriptionAttribute("[StData]表格数据,[StBarChart]饼图,[StEqBarChart]柱形图,[StCurveChart]曲线图")]
        /// <summary>
        /// 图形分类
        /// </summary>
        public string ChartView
        {
            get { return bean.ChartProperties.Advanced.ChartView; }
            set { bean.ChartProperties.Advanced.ChartView = value; }
        }
        [DescriptionAttribute("只有分类为[StData]下才存在行双击事件")]
        public string Javascript
        {
            get { return bean.ChartProperties.Advanced.Javascript == "" ? "[NULL]" : "[JAVASCRIPT]"; }
            set { }
        }
        [Description("启用树结构类型")]
        public bool TreeEnable
        {
            get
            {
                return bean.ChartProperties.Advanced.TreeEnable ;
            }

            set
            {
                bean.ChartProperties.Advanced.TreeEnable = value;
            }
        }

        [Description("树结构关系pId字段，字段数据类型必须是Int类型")]
        public string TreeField
        {
            get
            {
                return bean.ChartProperties.Advanced.TreeField;
            }

            set
            {
                bean.ChartProperties.Advanced.TreeField = value ;
            }
        }
        [Description("树结构关系JSON结构,如{pId:1,level:2,node:true}")]
        public string TreeJson
        {
            get
            {
                return bean.ChartProperties.Advanced.TreeJson;
            }

            set
            {
                bean.ChartProperties.Advanced.TreeJson = value;
            }
        }

    }
}
